﻿namespace Specifications
{
    //[TestFixture]
    //public class The_dialog_for_requesting_credentials
    //{
    //    #region Setup/Teardown

    //    [SetUp]
    //    public void given_a_context_of()
    //    {
    //        _client = MockRepository.GenerateStub<IClientAdapter>();
    //        _settings = MockRepository.GenerateStub<IUserSettings>();
    //        _presenter = new CredentialsPresenter(_client, _settings);
    //    }

    //    #endregion

    //    private IClientAdapter _client;
    //    private IUserSettings _settings;
    //    private CredentialsPresenter _presenter;

    //    [Test]
    //    public void can_set_credentials_for_the_client()
    //    {
    //        var username = "username";
    //        var remotekey = "remotekey";

    //        _presenter.Nickname = username;
    //        _presenter.RemoteKey = remotekey;
    //        _presenter.SetCredentials();

    //        _client.AssertWasCalled(x => x.SetCredentials(username, remotekey));
    //    }

    //    [Test]
    //    public void raises_close_when_canceled()
    //    {
    //        bool was_close_called = false;
    //        _presenter.Close += (s, e) => { was_close_called = true; };
    //        _presenter.Cancel();

    //        Assert.That(was_close_called);
    //    }

    //    [Test]
    //    public void raises_close_when_credentials_are_set()
    //    {
    //        bool was_close_called = false;
    //        _presenter.Close += (s, e) => { was_close_called = true; };
    //        _presenter.SetCredentials();

    //        Assert.That(was_close_called);
    //    }

    //    [Test]
    //    public void result_is_false_when_canceled()
    //    {
    //        _presenter.Cancel();
    //        Assert.That(_presenter.Result, Is.False);
    //    }

    //    [Test]
    //    public void result_is_true_when_credentials_are_set()
    //    {
    //        _presenter.SetCredentials();
    //        Assert.That(_presenter.Result, Is.True);
    //    }

    //    [Test]
    //    public void updates_settings_when_credentials_are_set()
    //    {
    //        var username = "username";
    //        var remotekey = "remotekey";

    //        _presenter.Nickname = username;
    //        _presenter.RemoteKey = remotekey;
    //        _presenter.SetCredentials();

    //        Assert.That(_settings.Nickname, Is.EqualTo(username));
    //        Assert.That(_settings.RemoteKey, Is.EqualTo(remotekey));
    //        _settings.AssertWasCalled(x => x.Save());
    //    }
    //}
}